#!/usr/bin/env node

const fs=require('fs'),
      file=process.argv[2];
      log=console.log;

if(process.argv.length!==3){
  console.error('格式：cmd fileName');
  peocess.exit(1)
}
let buf;
try{
  buf=fs.readFileSync(file);
}catch (e){
  console.error(e.message);
  process.exit(2);
}
if (buf.toString('ascii',0,2)==='BM'){
  log('width:',buf.readInt32LE(0x12));
  log('heigth:',buf.readInt32LE(0x16));
  log('color depth:',buf.readUInt16LE(0x1c))
}
